package thread;

/*
 * @author zzr
 * @date: 2025/03/29  15:44
 * @description:
 */
public class ThreadDemo14 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            int n = 5;
            for (int i = 0; i < n; i++) {
                System.out.println("线程正在执行中");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("线程执行完毕");
        });
        t.start();

        Thread.sleep(6000);

        System.out.println("这是主线程, 期望这个日志在 t 结束后打印");
    }
}
